package cn.ddiancan.schedule.base.domain;

import lombok.AllArgsConstructor;
import org.springframework.util.StringUtils;

@AllArgsConstructor
public enum CronTypeEum {
    WEEK("WEEK", "周"),
    MONTH("MONTH", "月"),
    DAY("DAY", "日"),
    MONTH_LAST("MON_LAST", "每月最后一天"),
    MONTH_WEEK("MON_WEEK", "每月星期几"),
    UNKNOWN("UNKNOWN", "未定义");

    private String code;
    private String desc;

    public static CronTypeEum getCronTypeEum(String code) {
        if(StringUtils.isEmpty(code)){
            return UNKNOWN;
        }
        return CronTypeEum.valueOf(code);
    }
}
